using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Pix2Gallery2
{
    public partial class PSEUsageInstructionsForm : Form
    {
        string _pseVersion;
        const string _pse5Album = "Collection";
        const string _pse6Album = "Album";
        const string _pse5Albums = "Collections";
        const string _pse6Albums = "Albums";
        bool boolShowOnStartupChanged = false;
        private Pix2Gallery2Settings pix2gallery2Settings;
        public PSEUsageInstructionsForm(string pseVersion)
        {
            InitializeComponent();
            _pseVersion = pseVersion;
        }

        private void PSEUsageInstructionsForm_Load(object sender, EventArgs e)
        {
            label1.Text = ReturnUsageInstructions();
            pix2gallery2Settings = new Pix2Gallery2Settings();
            if (this.pix2gallery2Settings.LoadAppSettings())
            {
                this.cbxShowOnStartup.Checked = !pix2gallery2Settings.PSE_HideInstructionsOnStartup;
            }
        }
        private string ReturnUsageInstructions()
        {
            string pseAlbum = "";
            string pseAlbums = "";
            switch (_pseVersion)
            {
                case "5":
                    pseAlbum = _pse5Album;
                    pseAlbums = _pse5Albums;
                    break;
                case "6":
                    pseAlbum = _pse6Album;
                    pseAlbums = _pse6Albums;
                    break;
            }
            string returnString =
                "Recommended usage for the Photoshop Elements integration component of Pix2Gallery2:\n\n" +
                "1) Upload pictures to Photoshop Elements (PSE)\n" +
                "2) Tag them as usual (People/places/events/etc)\n" +
                "3) Create a PSE " + pseAlbum + " for each Event you wish to see as a Gallery2 Album for " +
                "(Birthday party, family reunion, etc). Keep in mind that the album structure within Gallery2 " +
                "will be created in exactly the same structure as the " + pseAlbums + " within PSE. " +
                "So if you create a " + pseAlbum + " structure by the use of " + pseAlbum + " Groups, " +
                "the same structure will appear in Gallery2.\n" +
                "4) Put the appropriate photos in the PSE " + pseAlbums + "\n" +
                "5) Use the star ratings for the photos - if you only want to upload half of the photos to from PSE to Gallery2, " +
                "you can label the photos you want to upload with 5 stars, and the ones you dont as 0 stars.\n" +
                "6) Use the Hidden option to hide photos you will never want to upload (this will also hide it within PSE\n" +
                "7) Open up Pix2Gallery2, select the Album, set the starts to \"5 Stars\" only (Untick the rest), and Upload\n";
            return returnString;
        }

        private void cbxShowOnStartup_CheckedChanged(object sender, EventArgs e)
        {
            boolShowOnStartupChanged = true;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (boolShowOnStartupChanged)
            {
                this.pix2gallery2Settings.PSE_HideInstructionsOnStartup = !cbxShowOnStartup.Checked;
                this.pix2gallery2Settings.SaveAppSettings();
                if (this.pix2gallery2Settings.lastErrorMessage != "")
                {
                    MessageBox.Show("Error: " + this.pix2gallery2Settings.lastErrorMessage);
                }
            }
            this.Close();
        }
    }
}